package com.mzy.datepackage.M2022.Aug.thirty_first.service.tasks;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mzy.datepackage.M2022.Aug.thirty_first.service.tasks.dzxy_sync.Resource;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;

/**
 * 定制协议任务列表
 * */
@Data
@ApiModel(value = "定制协议服务")
public class CustomProtocol {

    /**
     * 服务id，不可重复
     */
    @ApiModelProperty(value = "唯一ID")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private int id;

    /**
     * 规则名
     */
    @ApiModelProperty(value = "服务名称,不能为空")
    private String name;

    /**
     * 前置端id
     */
    @ApiModelProperty(value = "前置ID，不能为空")
    @JSONField(name = "front_client_id")
    private String frontClientId;

    /**
     * 后置端id
     */
    @ApiModelProperty(value = "后置ID，不能为空")
    @JSONField(name = "post_client_id")
    private String postClientId;

    /**
     * 数据资源
     * */
    @Valid
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Resource resource;

    /**
     * 规则唯一标识
     */
    @ApiModelProperty(value = "token值")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private String token;

    /**
     * 说明
     */
    @ApiModelProperty(value = "说明")
    private String info;

    /**
     * 方向, 0: 内->外, 1: 外->内
     */
    @ApiModelProperty(value = "方向")
    private int type;

    /**
     * 模式, 0: 异步, 99: 同步
     */
    @ApiModelProperty(value = "模式, 0:异步, 99:同步")
    private int mode;

    /**
     * 接收数据协议号
     */
    @ApiModelProperty(value = "接收协议, 1:soap, 2:from-data")
    @JSONField(name = "recv_pol_num")
    private int recvPolNum;

    /**
     * 发送数据协议号
     */
    @ApiModelProperty(value = "发送协议, 1:soap, 2:from-data")
    @JSONField(name = "send_pol_num")
    private int sendPolNum;

    /**
     * 是否启用安全检查, 0: 不启用, 1. 启用
     */
    @ApiModelProperty(value = "安全检查, 0:不启用, 1:启用")
    @JSONField(name = "enable_security_check")
    private int enableSecurityCheck;

    /**
     * 黑名单过滤正则表达式, json数组
     */
    @ApiModelProperty(value = "黑名单过滤")
    @JSONField(name = "black_list_content_filter_regex")
    private String blackListContentFilterRegex;

    /**
     * 服务状态，stop停止，run表示运行中
     * */
    @ApiModelProperty(value = "服务状态，stop停止，run表示运行中")
    private String state;

    /**
     * 接收状态
     */
    @ApiModelProperty(value = "接收状态")
    @JSONField(name = "is_allow_recv")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private boolean isAllowRecv;

    /**
     * 发送状态
     */
    @ApiModelProperty(value = "发送状态")
    @JSONField(name = "is_allow_send")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private boolean isAllowSend;

    /**
     * 预警值
     */
    @ApiModelProperty(value = "预警值，不能为空")
    @JSONField(name = "warn_num")
    private int warnNum;

    /**
     * 风险值
     */
    @ApiModelProperty(value = "风险值，不能为空")
    @JSONField(name = "risk_num")
    private int riskNum;

    /**
     * 优先级
     */
    @ApiModelProperty(value = "优先级，不能为空")
    private int weight;

    /**
     * soap版本
     */
    @ApiModelProperty(value = "soap版本，不能为空")
    private float soap;


//    /**
//     * 接收状态
//     */
//    private boolean is_allow_recv;
//
//    /**
//     * 发送状态
//     */
//    private boolean is_allow_send;
//
//    /**
//     * 预警值
//     */
//    private int warn_num;
//
//    /**
//     * 风险值
//     */
//    private int risk_num;
//
//    /**
//     * 优先级
//     */
//    private int weight;
//
//    /**
//     * soap版本
//     */
//    private float soap;

//    public CustomProtocol(int id, String name, String frontClientId, String postClientId, Resource resource, String token,
//                          String info, int type, int mode, int recvPolNum, int sendPolNum, int enableSecurityCheck,
//                          String blackListContentFilterRegex, String state) {
//        this.id = id;
//        this.name = name;
//        this.frontClientId = frontClientId;
//        this.postClientId = postClientId;
//        this.resource = resource;
//        this.token = token;
//        this.info = info;
//        this.type = type;
//        this.mode = mode;
//        this.recvPolNum = recvPolNum;
//        this.sendPolNum = sendPolNum;
//        this.enableSecurityCheck = enableSecurityCheck;
//        this.blackListContentFilterRegex = blackListContentFilterRegex;
//        this.state = state;
//
//    }
//
//    public CustomProtocol(int id, String name, String frontClientId, String postClientId, Resource resource, String token,
//                          String info, int type, int mode, int recvPolNum, int sendPolNum, int enableSecurityCheck,
//                          String blackListContentFilterRegex, String state, boolean is_allow_recv, boolean is_allow_send,
//                          int warn_num, int risk_num, int weight, float soap) {
//        this.id = id;
//        this.name = name;
//        this.frontClientId = frontClientId;
//        this.postClientId = postClientId;
//        this.resource = resource;
//        this.token = token;
//        this.info = info;
//        this.type = type;
//        this.mode = mode;
//        this.recvPolNum = recvPolNum;
//        this.sendPolNum = sendPolNum;
//        this.enableSecurityCheck = enableSecurityCheck;
//        this.blackListContentFilterRegex = blackListContentFilterRegex;
//        this.state = state;
//        this.is_allow_recv = is_allow_recv;
//        this.is_allow_send = is_allow_send;
//        this.warn_num = warn_num;
//        this.risk_num = risk_num;
//        this.weight = weight;
//        this.soap = soap;
//    }


}
